import * as echarts from 'echarts';


export const getPieChart = (chartDom) => {
    let myChart = echarts.init(chartDom);
    let option;

    option = {
        tooltip: {
            trigger: 'item'
        },
        series: [
            {
                type: 'pie',
                radius: '70%',
                data: [
                    { value: 19, name: '已完成' },
                    { value: 23, name: '已超时' },
                    { value: 33, name: '待完成' },
                ],
                emphasis: {
                    itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                    }
                }
            }
        ]
    };
    option && myChart.setOption(option);
    window.onresize = () => {
        //自适应大小, 不用的话不会自适应大小。
        myChart.resize();
    };
}
